use log::info;

#[test]
fn trait_test() {
    let a1 = A1;
    let b1 = B1;
    ff(&b1);
    ff(&a1);

    ff2(b1);
    ff2(a1);
}
trait A {
    fn h(&self);
}

trait B: A {
    fn b1(&self);
}

struct  A1;
impl A for A1 {
    fn h(&self) {
        info!("A1 h");
    }
}

struct B1;

impl A for B1 {
    fn h(&self) {
        info!("B1 h");
    }
}

impl B for B1 {
    fn b1(&self) {
        info!("B1 b1");
    }
}

fn ff(f: &dyn A) {
   f.h();
}

fn ff2(f: impl A) {
    f.h();
}